package student.dao;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.springframework.orm.ibatis.SqlMapClientTemplate;

import student.dto.ScheduleDTO;

public class ScheduleDAO {
	
	private static SqlMapClientTemplate client;	
		
	public void setSqlMapClientTemplate(SqlMapClientTemplate client) {
		this.client = client;		
	}
	
	public ScheduleDTO getScheduleByNoDAO(String no) {
		System.out.println("DAO : "+no);
		return (ScheduleDTO) client.queryForObject("schedule.getScheduleByNo", no);
	}
	
	public void modifyScheduleDAO(ScheduleDTO sdto) {
		
		client.update("schedule.modifySchedule", sdto);
		
	}
	
	public void deleteScheduleByNoDAO(String no){
		client.delete("schedule.deleteScheduleByNo", no);
	}
	public void insertScheduleDAO(ScheduleDTO sdto){
		sdto.setScheduleNo((Integer) client.queryForObject("schedule.getScheduleNoSqe"));
		
		client.insert("schedule.insertSchedule", sdto);
	}
	
	public ArrayList<ScheduleDTO> getAllSchedule(HashMap map){
		System.out.println("1212 : "+map);
		return (ArrayList<ScheduleDTO>) client.queryForList("schedule.selectAllSchedule", map);		
	}
	
	public ArrayList<ScheduleDTO> getAllScheduleDAOByList() throws Exception{
		return (ArrayList<ScheduleDTO>) client.queryForList("schedule.selectAllScheduleByList");
		
	}
	
	public ArrayList getMenuByUserDAO() throws Exception{	
		return (ArrayList) client.queryForList("schedule.getMenuByUser");
	}	
	
	

}
